073dc8
@@ -59,19 +59,23 @@
public void run(HookContext hookContext) throws Exception {
         // of the object, before it was modified by StatsTask.
         // Get the latest versions of the object
         case TABLE: {
-          Table t = db.getTable(re.getTable().getTableName());
+          String dbName = re.getTable().getDbName();
+          String tblName = re.getTable().getTableName();
+          Table t = db.getTable(dbName, tblName);
           t.setLastAccessTime(lastAccessTime);
-          db.alterTable(t, null);
+          db.alterTable(dbName + "." + tblName, t, null);
           break;
         }
         case PARTITION: {
+          String dbName = re.getTable().getDbName();
+          String tblName = re.getTable().getTableName();
           Partition p = re.getPartition();
-          Table t = db.getTable(p.getTable().getTableName());
+          Table t = db.getTable(dbName, tblName);
           p = db.getPartition(t, p.getSpec(), false);
           p.setLastAccessTime(lastAccessTime);
-          db.alterPartition(t.getTableName(), p, null);
+          db.alterPartition(dbName, tblName, p, null);
           t.setLastAccessTime(lastAccessTime);
-          db.alterTable(t, null);
+          db.alterTable(dbName + "." + tblName, t, null);
           break;
         }
         default:
